package com.xjrsoft.module.customerTwo.aiplm.t_aiplm_text2img_simple.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_text2img_simple.entity.TAiplmText2imgSimple;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_text2img_simple.dto.TAiplmText2imgSimpleListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_text2img_simple.mapper.TAiplmText2imgSimpleMapper;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_text2img_simple.service.ITAiplmText2imgSimpleService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author dongxinhang
 * @since 2024-07-04
 */
@Service
@AllArgsConstructor
public class TAiplmText2imgSimpleServiceImpl extends BaseService<TAiplmText2imgSimpleMapper, TAiplmText2imgSimple> implements ITAiplmText2imgSimpleService {


	@Override
	public IPage<TAiplmText2imgSimple> getPageList(TAiplmText2imgSimpleListDto pageListDto) {
		Wrapper<TAiplmText2imgSimple> wrapper = Wrappers.<TAiplmText2imgSimple>query().lambda()
				.like(!StringUtil.isEmpty(pageListDto.getPrompt()), TAiplmText2imgSimple::getPrompt, pageListDto.getPrompt());
		return this.page(ConventPage.getPage(pageListDto), wrapper);
	}

	@Override
	public boolean addTAiplmText2imgSimple(TAiplmText2imgSimple tAiplmText2imgSimple) {
		boolean isSuccess = this.save(tAiplmText2imgSimple);
		return isSuccess;
	}

	@Override
	public boolean updateTAiplmText2imgSimple(String id, TAiplmText2imgSimple tAiplmText2imgSimple) {
		tAiplmText2imgSimple.setId(id);
		return this.updateById(tAiplmText2imgSimple);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

}